package net.entelijan.cobean.examples.showcase.config.text;

import java.awt.Color;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import net.entelijan.cobean.examples.util.ExamplesUtil;
import net.entelijan.scf.DefaultShowcasePanel;
import net.miginfocom.swing.MigLayout;

public class ConfigBookTextPanel extends DefaultShowcasePanel {

	private static final long serialVersionUID = 1L;

	private JTextField failureTextField;

	private JTextField idTextField;

	private JTextField titleTextField;

	private JTextField subtitleTextField;

	private JTextField yearTextField;

	private JButton showModelButton = new JButton("Show Model");

	private JButton resetButton = new JButton("Reset");

	private JButton defaultValuesButton = new JButton("Default Values");

	public ConfigBookTextPanel() {
		super();

		failureTextField = createFailureTextField();
		idTextField = new JTextField();
		titleTextField = new JTextField();
		subtitleTextField = new JTextField();
		yearTextField = new JTextField();

		setLayout(new MigLayout());
		add(new JLabel(""), "w 100:100:100");
		add(failureTextField, "w max, wrap");
		add(new JLabel("Id"), "");
		add(idTextField, "w max, wrap");
		add(new JLabel("Title"), "");
		add(titleTextField, "w max, wrap");
		add(new JLabel("Subtitle"), "");
		add(subtitleTextField, "w max, wrap");
		add(new JLabel("Year"), "");
		add(yearTextField, "w max, wrap");

		add(new JPanel(), "h max, w max, span 2, wrap");

		add(ExamplesUtil.createButtonsPanel(150, this.showModelButton,
				this.resetButton, this.defaultValuesButton), "span 2");

	}

	private JTextField createFailureTextField() {
		JTextField re = new JTextField();
		re.setBorder(null);
		re.setForeground(Color.RED);
		re.setEditable(false);
		return re;
	}

	public JTextField getFailureTextField() {
		return failureTextField;
	}

	public void setFailureTextField(JTextField failureTextField) {
		this.failureTextField = failureTextField;
	}

	public JTextField getIdTextField() {
		return idTextField;
	}

	public void setIdTextField(JTextField idTextField) {
		this.idTextField = idTextField;
	}

	public JTextField getTitleTextField() {
		return titleTextField;
	}

	public void setTitleTextField(JTextField titleTextField) {
		this.titleTextField = titleTextField;
	}

	public JTextField getSubtitleTextField() {
		return subtitleTextField;
	}

	public void setSubtitleTextField(JTextField subtitleTextField) {
		this.subtitleTextField = subtitleTextField;
	}

	public JTextField getYearTextField() {
		return yearTextField;
	}

	public void setYearTextField(JTextField yearTextField) {
		this.yearTextField = yearTextField;
	}

	public JButton getShowModelButton() {
		return showModelButton;
	}

	public void setShowModelButton(JButton showModelButton) {
		this.showModelButton = showModelButton;
	}

	public JButton getResetButton() {
		return resetButton;
	}

	public void setResetButton(JButton resetButton) {
		this.resetButton = resetButton;
	}

	public void setDefaultValuesButton(JButton defaultValuesButton) {
		this.defaultValuesButton = defaultValuesButton;
	}

	public JButton getDefaultValuesButton() {
		return defaultValuesButton;
	}


}
